home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / src / cblas / test_spr2.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-18  |  4.2 KB  |  180 lines

  1. #include <gsl/gsl_test.h>
  2. #include <gsl/gsl_ieee_utils.h>
  3. #include <gsl/gsl_math.h>
  4. #include <gsl/gsl_cblas.h>
  5.  
  6. #include "tests.h"
  7.  
  8. void
  9. test_spr2 (void) {
  10. const double flteps = 1e-4, dbleps = 1e-6;
  11.   {
  12.    int order = 101;
  13.    int uplo = 121;
  14.    int N = 2;
  15.    float alpha = -1.0f;
  16.    float Ap[] = { 0.493f, -0.175f, -0.831f };
  17.    float X[] = { -0.163f, 0.489f };
  18.    int incX = -1;
  19.    float Y[] = { 0.154f, 0.769f };
  20.    int incY = -1;
  21.    float Ap_expected[] = { -0.259082f, -0.124959f, -0.780796f };
  22.    cblas_sspr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  23.    {
  24.      int i;
  25.      for (i = 0; i < 3; i++) {
  26.        gsl_test_rel(Ap[i], Ap_expected[i], flteps, "sspr2(case 1442)");
  27.      }
  28.    };
  29.   };
  30.  
  31.  
  32.   {
  33.    int order = 101;
  34.    int uplo = 122;
  35.    int N = 2;
  36.    float alpha = -1.0f;
  37.    float Ap[] = { 0.493f, -0.175f, -0.831f };
  38.    float X[] = { -0.163f, 0.489f };
  39.    int incX = -1;
  40.    float Y[] = { 0.154f, 0.769f };
  41.    int incY = -1;
  42.    float Ap_expected[] = { -0.259082f, -0.124959f, -0.780796f };
  43.    cblas_sspr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  44.    {
  45.      int i;
  46.      for (i = 0; i < 3; i++) {
  47.        gsl_test_rel(Ap[i], Ap_expected[i], flteps, "sspr2(case 1443)");
  48.      }
  49.    };
  50.   };
  51.  
  52.  
  53.   {
  54.    int order = 102;
  55.    int uplo = 121;
  56.    int N = 2;
  57.    float alpha = -1.0f;
  58.    float Ap[] = { 0.493f, -0.175f, -0.831f };
  59.    float X[] = { -0.163f, 0.489f };
  60.    int incX = -1;
  61.    float Y[] = { 0.154f, 0.769f };
  62.    int incY = -1;
  63.    float Ap_expected[] = { -0.259082f, -0.124959f, -0.780796f };
  64.    cblas_sspr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  65.    {
  66.      int i;
  67.      for (i = 0; i < 3; i++) {
  68.        gsl_test_rel(Ap[i], Ap_expected[i], flteps, "sspr2(case 1444)");
  69.      }
  70.    };
  71.   };
  72.  
  73.  
  74.   {
  75.    int order = 102;
  76.    int uplo = 122;
  77.    int N = 2;
  78.    float alpha = -1.0f;
  79.    float Ap[] = { 0.493f, -0.175f, -0.831f };
  80.    float X[] = { -0.163f, 0.489f };
  81.    int incX = -1;
  82.    float Y[] = { 0.154f, 0.769f };
  83.    int incY = -1;
  84.    float Ap_expected[] = { -0.259082f, -0.124959f, -0.780796f };
  85.    cblas_sspr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  86.    {
  87.      int i;
  88.      for (i = 0; i < 3; i++) {
  89.        gsl_test_rel(Ap[i], Ap_expected[i], flteps, "sspr2(case 1445)");
  90.      }
  91.    };
  92.   };
  93.  
  94.  
  95.   {
  96.    int order = 101;
  97.    int uplo = 121;
  98.    int N = 2;
  99.    double alpha = 0;
  100.    double Ap[] = { 0.938, 0.342, 0.74 };
  101.    double X[] = { 0.216, -0.566 };
  102.    int incX = -1;
  103.    double Y[] = { -0.845, 0.282 };
  104.    int incY = -1;
  105.    double Ap_expected[] = { 0.938, 0.342, 0.74 };
  106.    cblas_dspr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  107.    {
  108.      int i;
  109.      for (i = 0; i < 3; i++) {
  110.        gsl_test_rel(Ap[i], Ap_expected[i], dbleps, "dspr2(case 1446)");
  111.      }
  112.    };
  113.   };
  114.  
  115.  
  116.   {
  117.    int order = 101;
  118.    int uplo = 122;
  119.    int N = 2;
  120.    double alpha = 0;
  121.    double Ap[] = { 0.938, 0.342, 0.74 };
  122.    double X[] = { 0.216, -0.566 };
  123.    int incX = -1;
  124.    double Y[] = { -0.845, 0.282 };
  125.    int incY = -1;
  126.    double Ap_expected[] = { 0.938, 0.342, 0.74 };
  127.    cblas_dspr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  128.    {
  129.      int i;
  130.      for (i = 0; i < 3; i++) {
  131.        gsl_test_rel(Ap[i], Ap_expected[i], dbleps, "dspr2(case 1447)");
  132.      }
  133.    };
  134.   };
  135.  
  136.  
  137.   {
  138.    int order = 102;
  139.    int uplo = 121;
  140.    int N = 2;
  141.    double alpha = 0;
  142.    double Ap[] = { 0.938, 0.342, 0.74 };
  143.    double X[] = { 0.216, -0.566 };
  144.    int incX = -1;
  145.    double Y[] = { -0.845, 0.282 };
  146.    int incY = -1;
  147.    double Ap_expected[] = { 0.938, 0.342, 0.74 };
  148.    cblas_dspr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  149.    {
  150.      int i;
  151.      for (i = 0; i < 3; i++) {
  152.        gsl_test_rel(Ap[i], Ap_expected[i], dbleps, "dspr2(case 1448)");
  153.      }
  154.    };
  155.   };
  156.  
  157.  
  158.   {
  159.    int order = 102;
  160.    int uplo = 122;
  161.    int N = 2;
  162.    double alpha = 0;
  163.    double Ap[] = { 0.938, 0.342, 0.74 };
  164.    double X[] = { 0.216, -0.566 };
  165.    int incX = -1;
  166.    double Y[] = { -0.845, 0.282 };
  167.    int incY = -1;
  168.    double Ap_expected[] = { 0.938, 0.342, 0.74 };
  169.    cblas_dspr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  170.    {
  171.      int i;
  172.      for (i = 0; i < 3; i++) {
  173.        gsl_test_rel(Ap[i], Ap_expected[i], dbleps, "dspr2(case 1449)");
  174.      }
  175.    };
  176.   };
  177.  
  178.  
  179. }
  180.